<?php
include_once('admin/php/includes/definer.php');
include_once(INC.'admin/php/bootstrap.php');
include_once(INC.'php/checkers/gallery.checker.php');
?>
<!DOCTYPE html>
<!--[if IE 8]> 				 <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->

    <head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" >
        <meta charset="iso-8859-1" />
        <meta name="viewport" content="width=device-width" />
        <title>Marcos Furer - Photography</title>

        <link rel="stylesheet" href="<?php echo(URL); ?>stylesheets/normalize.css" />
        <link href='http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic' rel='stylesheet' type='text/css'>
        <link href="<?php echo(URL); ?>javascripts/galeria/jquery.mCustomScrollbar.css" rel="stylesheet" type="text/css" />
        <link rel="stylesheet" href="<?php echo(URL); ?>stylesheets/app.css" />
        <link rel="stylesheet" href="<?php echo(URL); ?>stylesheets/efs.css" />
        
        <meta property="og:title" content="Marcos Furer - Photography" />
        <meta property="og:type" content="website" />
        <meta property="og:url" content="http://www.marcosfurer.com/" />
        <meta property="og:image" content="http://www.marcosfurer.com/content/img/furer-facebook.jpg" />
        <meta property="og:site_name" content="Marcos Furer - Photography" />
        <meta property="fb:admins" content="552054148" />
        <meta property="og:description" content="To photograph is to hold one's breath, when all faculties converge to capture fleeting reality." />

        <script src="<?php echo(URL); ?>javascripts/vendor/custom.modernizr.js"></script>
        <style>
            body, #main-gallery, .content_6 {margin-right:-32000px}
            #main-gallery .item {float:left}
        </style>
    </head>
    <body>
        <!-- MENU -->
        <?php include_once(INC.'tpl/menu.php'); ?>
        <!-- FIN MENU -->
        <!-- GALERIA -->
        <section id="galeria">
            <div class="row full-width mCustomScrollbar">
                <div class="large-12 columns">
                    
                    <div class="content_6 content" id="main-gallery">
                        <div id="img0" class="gallery-info-box padding-content item">
                            <h2><?php echo(htmlentities($GALLERY->titulo)); ?></h2>
                            <p class="light"><?php echo(nl2br(htmlentities($GALLERY->titulo))); ?></p>
                        </div>
                        <?php
                            foreach ($GALLERY->imagenes() as $imagen) {
                                echo('<img class="item" src="'.URL.'content/photography/'.$GALLERY->photography->uri.'/'.$imagen->src.'" id="img'.$imagen->id.'" alt="" />');
                            }
                        ?>
                    </div>
                </div>
            </div>
        </section>
        <!-- FIN GALERIA -->
        <!-- FOOTER GALERIA -->
        <footer>
            <!--<div style="position: fixed;bottom: 0px;left: 0px;width: 100%;z-index: 9999">-->
            <div id="gallery-footer">
                <div class="left">
                    <div class="project-nav">
                        <ul>
                            <li class="active has-sub"><a href="javascript:void(0);"><?php echo(htmlentities($GALLERY->photography->titulo)); ?>&nbsp;&nbsp;|&nbsp;&nbsp;<?php echo(Texto::cortar(htmlentities($GALLERY->titulo), 34)); ?> <span style="margin-left: 10px;color: #ccc">&#x25B2;</span></a>
                                <ul>
                                    <?php
                                        $html = '';
                                        $photographies = Doctrine::getTable('photography')->findAll();
                                        foreach ($photographies as $photography) {
                                            $html .= '<li class="has-sub"><a href="'.URL.'photography/'.$photography->uri.'"><span>'.htmlentities($photography->titulo).'</span></a><ul>';
                                            foreach ($photography->galleries() as $gallery) {
                                                $html .= '<li><a href="'.URL.'photography/'.$photography->uri.'/'.$gallery->uri.'"><span>'.  Texto::cortar(htmlentities($gallery->titulo), 23, '...').'</span></a></li>';
                                            }
                                            $html .= '</ul>';
                                        }
                                        echo($html);
                                    ?>
                                </ul>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="right hide-for-small">
                    <a href="javascript:void(0);" class="gallery-button prev-button"><</a>
                    <a href="javascript:void(0);" class="gallery-button next-button">></a>
                </div>
            </div>
            <!--</div>-->
        </footer>
        <!-- FIN FOOTER GALERIA -->
        <script>
            document.write('<script src=' + ('__proto__' in {} ? '<?php echo(URL); ?>javascripts/vendor/zepto' : '<?php echo(URL); ?>javascripts/vendor/jquery') + '.js><\/script>')
        </script>
        <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>

        <script src="<?php echo(URL); ?>javascripts/foundation/foundation.js"></script>

        <script src="<?php echo(URL); ?>javascripts/foundation/foundation.alerts.js"></script>

        <script src="<?php echo(URL); ?>javascripts/foundation/foundation.clearing.js"></script>

        <script src="<?php echo(URL); ?>javascripts/foundation/foundation.cookie.js"></script>

        <script src="<?php echo(URL); ?>javascripts/foundation/foundation.dropdown.js"></script>

        <script src="<?php echo(URL); ?>javascripts/foundation/foundation.forms.js"></script>

        <script src="<?php echo(URL); ?>javascripts/foundation/foundation.joyride.js"></script>

        <script src="<?php echo(URL); ?>javascripts/foundation/foundation.magellan.js"></script>

        <script src="<?php echo(URL); ?>javascripts/foundation/foundation.orbit.js"></script>

        <script src="<?php echo(URL); ?>javascripts/foundation/foundation.placeholder.js"></script>

        <script src="<?php echo(URL); ?>javascripts/foundation/foundation.reveal.js"></script>

        <script src="<?php echo(URL); ?>javascripts/foundation/foundation.section.js"></script>

        <script src="<?php echo(URL); ?>javascripts/foundation/foundation.tooltips.js"></script>

        <script src="<?php echo(URL); ?>javascripts/foundation/foundation.topbar.js"></script>

        <script src="<?php echo(URL); ?>javascripts/galeria/jquery.scrollTo-min.js"></script>

        <script src="<?php echo(URL); ?>javascripts/galeria/jquery.mousewheel.min.js"></script>

        <script src="<?php echo(URL); ?>javascripts/galeria/jquery.mCustomScrollbar.min.js"></script>

        <script src="<?php echo(URL); ?>javascripts/galeria/jquery.imagesloaded.js"></script>
        
        <script src="<?php echo(URL); ?>javascripts/stickyFooter.js"></script>

        <script>        
            
            var i=0;
            $(document).foundation();
            
            function ajustar() {
                $("#main-gallery").mCustomScrollbar("destroy");
                var viewportHeight = $(window).height() - 156;
                var viewportWidth = $(window).width();
                $('.content_6').css('height', viewportHeight);
                if (viewportWidth > 930) {
                    var max_img_height = viewportHeight - 15;
                    $("#main-gallery img").each(function(i,e){
                        var $img = $(e);
                        var nw = Math.floor($img.data('ow') * max_img_height /$img.data('oh'));
                        $img.height(max_img_height);
                        $img.width(nw);
                    })
                    $("#main-gallery").mCustomScrollbar({
                        horizontalScroll: true,
                        mouseWheelPixels: 500,
                        advanced: {
                            autoExpandHorizontalScroll: true
                        }
                    });
                } else {
                    var max_img_width = viewportWidth - 15;
                    $("#main-gallery img").each(function(i,e){
                        var $img = $(e);
                        $img.width('100%').height('')
                    })
                    $("#main-gallery").mCustomScrollbar({mouseWheelPixels: 500});
                }
            }
            
            $(function(){
                var $img = $('.content_6 img');
                $('.content_6').imagesLoaded(function( $images, $proper, $broken ){
                    $images.each(function(i,e){
                        $(e).data('ow', $(e).width())
                        $(e).data('oh', $(e).height())
                    })
                    $('body, #main-gallery, .content_6').css({'margin-right':'0'})
                    $('#main-gallery img').css({'float':'none'})
                    ajustar();
                })
            })
            
            $(window).resize(function() {
                ajustar();
            });
            $(document).ready(function() {
                $('img').on('dragstart', function(event) { event.preventDefault(); });
                $(document).bind("contextmenu",function(e){
                    return false;
                });
                $('#main-gallery .item').click(function() {
                    i = $(this).index();
                    $('#main-gallery').mCustomScrollbar('scrollTo','#'+$(this).attr('id'));
                });
                $('.prev-button').click(function () {
                    i = ((i-1)>=0)?i-1:$('#main-gallery .item').length - 1;
                    $("#main-gallery").mCustomScrollbar("scrollTo",'#'+$('#main-gallery .item').eq(i).attr('id'));
                })
                $('.next-button').click(function () {
                    i = ((i+1)< $('#main-gallery .item').length)?i+1:0;
                    $("#main-gallery").mCustomScrollbar("scrollTo",'#'+$('#main-gallery .item').eq(i).attr('id'));
                })
            });
        </script>
    </body>
</html>

<!-- Localized -->